import {defineStore} from "pinia";
import axios from "axios";
import {nanoid} from "nanoid";

export const useLoveTalk = defineStore('loveTalk',{
    actions:{
       async getTalk(){
              try {
              let {data:{content:title}} =await axios.get('https://api.uomg.com/api/rand.qinghua?format=json')
              let obj = {id:nanoid(),title}
              this.talkList.unshift(obj)
            }catch (e) {

            }
        }
    },
    state(){
        return {
            talkList : [
                {id:'12312312qwrasa',title:'今天你有点怪，那里怪？怪好看的！'}
            ]
        }
    }
})